/*****************************************************************************/
/**
*
* @file uinterrupt.c
*
* General functions about scugic and interrupts.
*
* Ver   Who    Date   	Changes
* ----- ---- ---------- -------------------------------------------------------
* 0.01  abu  01/28/2019 File created.
* </pre>
*
******************************************************************************/


/***************************** Include Files *********************************/
#include "uinterrupt.h"

/************************** Constant Definitions *****************************/

/**************************** Type Definitions *******************************/

/***************** Macros (Inline Functions) Definitions *********************/

/************************** Variable Definitions *****************************/

/************************** Function Prototypes ******************************/

/*****************************************************************************/
/**
*
* Initialize scugic.
*
* @param	InstancePtr: pointer to one XScuGic variable
*
* @return	None.
*
* @note		1. initialize scugic related variables and pointers.
			2. connect peripheral interrupt handlers to XScuGic_InterruptHandler.
			3. register XScuGic_InterruptHandler to exception vector IRQInterrupt.
*
******************************************************************************/

void uScugicInit(XScuGic *InstancePtr)
{
	s32 status = XST_FAILURE;
	
	InstancePtr->Config = XScuGic_LookupConfig(uScugic_DevId);

	status = XScuGic_CfgInitialize(InstancePtr, InstancePtr->Config, InstancePtr->Config->CpuBaseAddress);
	if(status == XST_FAILURE)
		DEBUG("ERROR: uScugicInit failed in function XScuGic_CfgInitialize/n/r");

	//=========Connect interrupt handlers to scugic HandlerTable below========
	XScuGic_Connect(InstancePtr, u32 uGpioPsIntrID, uGpioPsIntrHandler, )
	//===============end of connection of interrupt handlers=================

	//register scugic interrupt handler to exception vector IRQ
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, XScuGic_InterruptHandler, InstancePtr);

}
